package com.service;

import com.entity.*;
import com.repository.DoctorRepository;
import com.repository.impl.DoctorRepositoryImpl;


import java.io.InputStream;
import java.util.Vector;

public class DoctorService {

    DoctorRepository doctorRepository=new DoctorRepositoryImpl();


//    通过工号查找医生
    public Doctor findThisDoctor(String workId){
        return doctorRepository.findDoctorByWorkId(workId);
    }

    public int doctorEnrollLogin(Doctor doctor){
        return doctorRepository.addDoctorLogin(doctor);
    }
    //是否查找成功
    public int doctorValidateLoginInfo(Doctor doctor){
        return doctorRepository.isDoctorLogin(doctor);
    }

    /**查找医生挂号集
     * 参数 医生workId state用于决定isAccomplish的值
     * 返回值 Vector<RegisterDoc>类**/
    public Vector<RegisterDoc> thisDoctorRegisters(String workId,int state){return doctorRepository.findAllRegisterDocByWorkId(workId,state);}

    /**添加诊断
     * 参数Diagnose类
     * 返回值 int 1:添加成功  2:添加失败**/
    public int addThisDiagnose(Diagnose diagnose){
        return doctorRepository.addDiagnose(diagnose);
    }

    public void addThisDrug(Drug addDrug) {
        doctorRepository.addDrug(addDrug);
    }

    public Vector<Drug> thisDoctorDrugs(String workId) {
        return doctorRepository.findAllDrugsByWorkId(workId);
    }

    public Vector<Diagnose> thisDoctorDiagnoses(String workId) {
        return doctorRepository.findAllDiagnosesByWorkId(workId);
    }

    public Doctor findThisDoctorByName(String addDoctorName) {
        return doctorRepository.findDoctorByName(addDoctorName);
    }

    public void changeState(int registerDocId) {
        doctorRepository.changeRegisterState(registerDocId);
    }
}